#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
int flag[1001];
void init()
{
	memset(flag,0,sizeof(flag));
	for(int i = 4;i<1001;i++)
	{
		int sign = 0;
		int x = i;
		while(x)
		{
			int t = x%10;
			x = x/10;
			if(t!=4&&t!=7) 
			{
				sign = 1;
				break;
			}
		}
		if(!sign) flag[i] = 1;
		if(flag[i])
		{
			for(int j = 2;(i*j)<1001;j++)
			{
				flag[i*j] = 1;
			}
		}
	}
}
int main()
{
	int n;
	init();
	while(scanf("%d",&n)!=EOF)
	{
		if(flag[n]) printf("YES\n");
		else printf("NO\n");
	}
	
}
